
    function loadUserLocationInfo() {
//		if(persionStr==-1)
//		{
//			alert("没有符合条件的数据！");
//			return;
//		}
		if(persionStr==0||persionStr=="0")
		{
        //	persionStr = $("#personList").find("span:first").attr("tag"); 
			var usersLenth = PersonData.length;
		 	for (var i = 0; i < usersLenth; i++) {	              
		                
				persionStr += PersonData[i].userId + ",";
			}
			if(persionStr.length > 1)
				persionStr = persionStr.substring(0, persionStr.length - 1);
		}
        $.ajax({
            type: "get",
            url: "fetchUserLocationInfo.action",
            data: { "dateStr": dateStr, "startdt": startdt, "enddt": enddt, "cityStr": cityStr, "persionStr": persionStr, "statusStr": statusStr, "page": page, "limit": limit },
            dataType: "jsonp",
            success: function (datas) {
            	if (datas.success == "sessionOut") {
	                window.location = "index.html";
	                return;
            	}
                clearMarker();
                showUserLocationInfo(datas);
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                //alert(errorThrown);
            }
        });
}

function showRegionUserInfo(data) {
    if (data.success == "true") {
        userName = data.realName;

        var cityLenth = data.cities.length;
        if (cityLenth > 0) {

            var inners = "";

            for (var i = 0; i < cityLenth; i++) {

				if(data.cities[i].name.length<7)
                	inners += "<div class=box><P><span class='templink' tag='" + data.cities[i].id + "' onclick='cityClick(this)'>" + data.cities[i].name + "</span></P></div>";
            	else 
            		inners += "<div class=boxl><P><span class='templink' tag='" + data.cities[i].id + "' onclick='cityClick(this)'>" + data.cities[i].name + "</span></P></div>";
            
            }
            $("#ISL_Cont_city").html("<div id='cityCon'></div>");
            $("#cityCon").html(inners);
            flagcity = true;           
            loadDatacity();
        }
        var usersLenth = data.users.length;
        if (usersLenth > 0) {

            var inners = "";

            for (var i = 0; i < usersLenth; i++) {
				
				if(data.users[i].realname.length<7)
                	inners += "<div class=box><P><span class='templink' tag='" + data.users[i].userId + "' onclick='personClick(this)'>" + data.users[i].realname + "</span></P></div>";
				else
					inners += "<div class=boxl><P><span class='templink' tag='" + data.users[i].userId + "' onclick='personClick(this)'>" + data.users[i].realname + "</span></P></div>";
				
            }
             $("#ISL_Cont_person").html("<div id='personCon'></div>");
            $("#personCon").html(inners);
            flagperson = true;            
            loadDataperson();

        }
         $("#cityList").find("span:first").removeClass("templink").addClass("templinkactiveuser");
         $("#personList").find("span:first").removeClass("templink").addClass("templinkactiveuser");
         //$("#stateList").find("span:first").removeClass("templink").addClass("templinkactiveuser");
    }
}


function personClick(sender) {
    var alink01 = $("#personList").find("span");
    persionStr = "";

    if ($(sender).attr("class") == "templink") {
        if ($(sender).html() == "全部")
            alink01.each(function () {

                $(this).removeClass("templinkactiveuser").addClass("templink");

            });
        else
            $("#personList").find("span:first").removeClass("templinkactiveuser").addClass("templink");
        $(sender).removeClass("templink").addClass("templinkactiveuser");
    }
    else {
        if ($(sender).html() != "全部")
            $(sender).removeClass("templinkactiveuser").addClass("templink");
    }

    alink01.each(function () {
        if ($(this).attr("class") == "templinkactiveuser") {
            persionStr += $(this).attr("tag") + ",";
        }

    });

    if (persionStr == "") {
        persionStr =  $("#personList").find("span:first").attr("tag");
       
        $("#personList").find("span:first").removeClass("templink").addClass("templinkactiveuser");
    }

    if (persionStr != 0)
        persionStr = persionStr.substring(0, persionStr.length - 1);
	page = 1;
    loadUserLocationInfo();
}


function cityClick(sender) {
    var alink02 = $("#cityList").find("span");
    cityStr = "";

    if ($(sender).attr("class") == "templink") {
        if ($(sender).html() == "全部")
            alink02.each(function () {

                $(this).removeClass("templinkactiveuser").addClass("templink");

            });
        else
            $("#cityList").find("span:first").removeClass("templinkactiveuser").addClass("templink");
        $(sender).removeClass("templink").addClass("templinkactiveuser");
    }
    else {
        if ($(sender).html() != "全部")
            $(sender).removeClass("templinkactiveuser").addClass("templink");
    }

    alink02.each(function () {
        if ($(this).attr("class") == "templinkactiveuser") {
            cityStr += $(this).attr("tag") + ",";
        }

    });

    if (cityStr == "") {
        cityStr = 0;
        $("#cityList").find("span:first").removeClass("templink").addClass("templinkactiveuser");
    }

    if (cityStr != 0)
        cityStr = cityStr.substring(0, cityStr.length - 1);

    personChange();
    page = 1;
    loadUserLocationInfo();
}

function stateClick(sender) {
    var alink03 = $("#stateList").find("span");
    statusStr = "";

    if ($(sender).attr("class") == "templink") {
        if ($(sender).html() == "全部")
            alink03.each(function () {

                $(this).removeClass("templinkactiveuser").addClass("templink");

            });
        else
            $("#stateList").find("span:first").removeClass("templinkactiveuser").addClass("templink");
        $(sender).removeClass("templink").addClass("templinkactiveuser");
    }
    else {
        if ($(sender).html() != "全部")
            $(sender).removeClass("templinkactiveuser").addClass("templink");
    }

    alink03.each(function () {
        if ($(this).attr("class") == "templinkactiveuser") {
            statusStr += $(this).attr("tag") + ",";
        }

    });

    if (statusStr == "") {
        statusStr = 0;
        $("#stateList").find("span:first").removeClass("templink").addClass("templinkactiveuser");
    }

    if (statusStr != 0)
        statusStr = statusStr.substring(0, statusStr.length - 1);
	page = 1;
    loadUserLocationInfo();
}

function personChange() {
	
      $("#personCon").html("");
	  var inners = "";
      var usersLenth = PersonData.length;

	  if(cityStr!=0 && cityStr!="0" && PersonData!=undefined)
	  {	   
	    var citys = cityStr.split(',');
	
	    if (usersLenth > 0) {
	      
		        persionStr = 0;
		        for (var n = 0; n < citys.length; n++) {
		
		            for (var i = 0; i < usersLenth; i++) {
		                if (PersonData[i].cityId == citys[n])
		                {
		                	if(PersonData[i].realname.length<7)
		                    	inners += "<div class=box><P><span class='templink' tag='" + PersonData[i].userId + "' onclick='personClick(this)'>" + PersonData[i].realname + "</span></P></div>";
							else
								inners += "<div class=boxl><P><span class='templink' tag='" + PersonData[i].userId + "' onclick='personClick(this)'>" + PersonData[i].realname + "</span></P></div>";
							
							persionStr += PersonData[i].userId + ",";
						}
		            }
		        }
		        if(persionStr != 0)  
		        {  		
    		  		persionStr = persionStr.substring(0, persionStr.length - 1);
		         	$("#personList").find("span:first").attr("tag",persionStr); 
                    city_personData_user = persionStr;
		      	}
		      	 else
		      		persionStr = -1;   
	        }
        }
        else
        {
        
		    for (var i = 0; i < usersLenth; i++) {	
		        if(PersonData[i].realname.length<7)	               
		            inners += "<div class=box><P><span class='templink' tag='" + PersonData[i].userId + "' onclick='personClick(this)'>" + PersonData[i].realname + "</span></P></div>";
			    else
				    inners += "<div class=boxl><P><span class='templink' tag='" + PersonData[i].userId + "' onclick='personClick(this)'>" + PersonData[i].realname + "</span></P></div>";
			    }
		         persionStr = 0;
		         $("#personList").find("span:first").attr("tag","0"); 
                 city_personData_user = persionStr;
        }
        $("#ISL_Cont_person").html("<div id='personCon'></div>");
        $("#personCon").html(inners);      
        $("#personList").find("span:first").removeClass("templink").addClass("templinkactiveuser");   	
    	
    	flagperson = true;
        loadDataperson();   
}

	var arrowList = new Array();
	var polyline = null;

function showUserLocationInfo(data) {
    if (data.success == "true") {
    	if(data.totalSize>0)
    	{
    		page_totle = Math.ceil(data.totalSize/limit); 
            if(data.info.length>limit)
                page_totle = 1;
    		if (page == 1) {
	            $("#ppLeft").css("color","gray");		
        	}else{
    			$("#ppLeft").css("color","blue");	
    		}   
    		
    		if(page_totle==1){
    			$("#ppRight").css("color","gray");			
    		}else{
    			$("#ppRight").css("color","blue");		
    		}	
    		
    		if(page == page_totle){
    			$("#ppRight").css("color","gray");		
    		}		
   		}
        if (data.info != undefined) {
            var infoLenth = data.info.length;
			userResultData = data;
            if (infoLenth > 0) {
                var inners = "";
                for (var i = 0; i < infoLenth; i++) {
                    inners += " <div id='listarea'>";
                    inners += "<div id='listareaLeft'><img src='images/pic_temp.png' width='40' height='40' /></div>";
                    inners += "<div id='listareaRight'>";
                    inners += "<div id='topcontent'>";
                    inners += "<div id='name'><a href='javascript:detailInfo_user("+data.info[i].id+","+data.info[i].lat+","+data.info[i].lon+")'>" + data.info[i].realname + "</a></div>";
                    inners += "<div id='time'><img src='images/time_ico.gif' width='18' height='18' class='ico' />" + data.info[i].formatDate + "</div>";
                    inners += " </div>  ";
                    inners += "<div id='bottomcontent'>";
                    inners += "<div id='address'>" + data.info[i].address + "</div>";
                    var posType = data.info[i].posType;
                    var posTypeC = "";
                    var imgurl = "";
                    switch (posType) {
                        case 1:
                            posTypeC = "上班";
                            imgurl = "images/arrow_up.gif";
                            break;
                        case 11:
                            posTypeC = "下班";
                            imgurl = "images/arrow_down.gif";
                            break;
                        case 2:
                            posTypeC = "签到";
                            imgurl = "images/flag_green.gif";
                            break;
                        case 3:
                            posTypeC = "定位";
                            imgurl = "images/icon_get_world.gif";
                            break;
                    }
                    inners += "<div id='status'><img src='" + imgurl + "' width='16' height='16' class='ico' />" + posTypeC + "</div>";
                    inners += " </div>  ";
                    inners += " </div>  ";
                    inners += " </div>  ";

                    if (data.info[i].lat != null && data.info[i].lon != null && positionInChina(data.info[i].lat, data.info[i].lon)) {
                        lat = data.info[i].lat;
                        lon = data.info[i].lon;

                        var point = new BMap.Point(lon, lat);    // 创建点坐标
                        if (i == 0) {
                            map.centerAndZoom(point, 13);                     // 初始化地图,设置中心点坐标和地图级别。
                        }
                        pintterArr.push(point);
                        addMarker_user(point, i, data.info[i].posType, data.info[i]);
                    }
                }
                if (pintterArr != null && pintterArr.length > 0){
                    map.setViewport(pintterArr);	
                    if((dateStr==1||dateStr==4)&&(persionStr!=0||persionStr!="0")&&(persionStr.split(',').length<2))
                    {
                        polyline = new BMap.Polyline(pintterArr, {strokeColor:"blue", strokeWeight:3, strokeOpacity:0.5});	
				        map.addOverlay(polyline);

                        var levels = map.getZoom()+3;
		
					    addArrow(polyline,levels,Math.PI/7);
                    }
                }
                $("#ShortlistContent").html(inners);
            }
        }
        else {
        	$("#ShortlistContent").html("");
        	$("#ppLeft").css("color","gray");	
        	$("#ppRight").css("color","gray");	
//            if ($("#menulist_user").css("visibility") == "visible")
            	//setTimeout("loadAlert()", 1500);
        }
    }
}

function loadAlert(){
	alert("没有符合条件的数据！");	
}

function detailInfo_user(uid,lat,lon){	 
   if (lat != null && lon != null && positionInChina(lat, lon)) { 
                        
      var point = new BMap.Point(lon, lat);   
       
        var infoLenth = userResultData.info.length;
	      if (infoLenth > 0) {   
	       for (var i = 0; i < infoLenth; i++) {  
				if(userResultData.info[i].id==uid)
				{
					var obj=userResultData.info[i];    
					var posType = obj.posType;
				    var posTypeC = "";
				    var imgurl = "";
				    switch (posType) {
				       case 1:
				           posTypeC = "上班";
				           img = "images/point_shangban.png";
				            break;
				       case 11:
				            posTypeC = "下班";
				            img = "images/point_xiaban.png";
				            break;
				        case 2:
				            posTypeC = "签到";
				            img = "images/point_qiandao.png";
				            break;
				       case 3:
				            posTypeC = "定位";
				            img = "images/point_dingwei.png";
				            break;
				    }  
    
			      	var htmlText = '<div id="popup_bg2">';
					//htmlText+=     ' <div id="closebtn"><a href="#"><img src="images/close_btn.png" width="16" height="15" /></a></div>';
					htmlText+=     '      <div id="textarea">';
					htmlText+=     '           <ul>';
					htmlText+=     '               <li><strong>人员</strong>：'+obj.realname+'</li>';
					htmlText+=     '               <li><strong>时间</strong>：'+obj.formatDate+'</li>';
					htmlText+=     '               <li><strong>地点</strong>：'+obj.address+'</li>';
					htmlText+=     '               <li><strong>内容</strong>：'+obj.actionContent+'</li>';
					htmlText+=     '               <li><strong>类型</strong>：'+posTypeC+'</li>';
					htmlText+=     '           </ul>';
					htmlText+=     '      </div>';
					
                    if(obj.posType!=3 && obj.imageUrl!=null)
                    {
                        htmlText+=     '<div id="picBG">';
					    if(obj.imageUrl!=null){
						    htmlText+=     '<a href ="'+obj.imageUrl+'" target=_blank><img src="'+obj.imageUrl+'" width="345" height="124" /></a>';
					    }else{
						    htmlText+=     '           <div id="leftbtn"><a href="#"><img src="images/left_btn.png" width="22" height="47" /></a></div>';
						    htmlText+=     '           <div id="rightbtn"><a href="#"><img src="images/right_btn.png" width="22" height="47" /></a></div>';
					    }
                        htmlText+=     '      </div>';
                    }
					
					htmlText+=     ' </div>';
					htmlText+=     '</div>';
			
					var opts = {  
					 width : 345,     // 信息窗口宽度  
					 height: 290,     // 信息窗口高度  
					 //title : "<b>"+obj.realname+"</b>"  // 信息窗口标题  
					};

                    var optss = {  
					 width : 345,     // 信息窗口宽度  
					 height: 100,     // 信息窗口高度  					
					};

					if(obj.posType!=3 && obj.imageUrl!=null)
                    {
                         var infoWindow = new BMap.InfoWindow(htmlText, opts);  // 创建信息窗口对象  
                    } 
					else
                         var infoWindow = new BMap.InfoWindow(htmlText, optss);  // 创建信息窗口对象  
					map.openInfoWindow(infoWindow, point);      // 打开信息窗口   
					}
				}
		}
       map.centerAndZoom(point, 17);                   
   }      
}


function addMarker_user(point, index,posType,obj){  
	var img = "images/marker_yellow.png";
    var posType = obj.posType;
    var posTypeC = "";
    var imgurl = "";
    switch (posType) {
       case 1:
           posTypeC = "上班";
           img = "images/point_shangban.png";
            break;
       case 11:
            posTypeC = "下班";
            img = "images/point_xiaban.png";
            break;
        case 2:
            posTypeC = "签到";
            img = "images/point_qiandao.png";
            break;
       case 3:
            posTypeC = "定位";
            img = "images/point_dingwei.png";
            break;
    }  
	
	// 创建图标对象  
	var myIcon = new BMap.Icon(img, new BMap.Size(46, 46), {  
	// 指定定位位置。  
	// 当标注显示在地图上时，其所指向的地理位置距离图标左上  
	   // 角各偏移10像素和25像素。您可以看到在本例中该位置即是  
	   // 图标中央下端的尖角位置。  
	   offset: new BMap.Size(10, 25),  	  
	   // 设置图片偏移。  
	   // 当您需要从一幅较大的图片中截取某部分作为标注图标时，您  
	   // 需要指定大图的偏移位置，此做法与css sprites技术类似。  
	   //imageOffset: new BMap.Size(0, 0 - index * 25)   // 设置图片偏移  
	 });    
	 // 创建标注对象并添加到地图  
	 var marker = new BMap.Marker(point, {icon: myIcon});
	 
	 marker.addEventListener("mouseover", function(){  
	 
		var htmlText = '<div id="popup_bg2">';
		//htmlText+=     ' <div id="closebtn"><a href="#"><img src="images/close_btn.png" width="16" height="15" /></a></div>';
		htmlText+=     '      <div id="textarea">';
		htmlText+=     '           <ul>';
		htmlText+=     '               <li><strong>人员</strong>：'+obj.realname+'</li>';
		htmlText+=     '               <li><strong>时间</strong>：'+obj.formatDate+'</li>';
		htmlText+=     '               <li><strong>地点</strong>：'+obj.address+'</li>';
		htmlText+=     '               <li><strong>内容</strong>：'+obj.actionContent+'</li>';
		htmlText+=     '               <li><strong>类型</strong>：'+posTypeC+'</li>';
		htmlText+=     '           </ul>';
		htmlText+=     '      </div>';
		
        if(obj.posType!=3 && obj.imageUrl!=null)
         {
            htmlText+=     '<div id="picBG">';
		    if(obj.imageUrl!=null){
			    htmlText+=     '<a href ="'+obj.imageUrl+'" target=_blank><img src="'+obj.imageUrl+'" width="345" height="124" /></a>';
		    }else{
			    htmlText+=     '           <div id="leftbtn"><a href="#"><img src="images/left_btn.png" width="22" height="47" /></a></div>';
			    htmlText+=     '           <div id="rightbtn"><a href="#"><img src="images/right_btn.png" width="22" height="47" /></a></div>';
		    }
        	htmlText+=     '      </div>';
        }
	
		htmlText+=     ' </div>';
		htmlText+=     '</div>';

		var opts = {  
		 width : 345,     // 信息窗口宽度  
		 height: 290,     // 信息窗口高度  
		 //title : "<b>"+obj.realname+"</b>"  // 信息窗口标题  
		}
		  
		 var optss = {  
		     width : 345,     // 信息窗口宽度  
			 height: 100,     // 信息窗口高度  					
		 };

		if(obj.posType!=3 && obj.imageUrl!=null)
          {
             var infoWindow = new BMap.InfoWindow(htmlText, opts);  // 创建信息窗口对象  
          } 
		else
             var infoWindow = new BMap.InfoWindow(htmlText, optss);  // 创建信息窗口对象  
		map.openInfoWindow(infoWindow, point);      // 打开信息窗口   
		//map.centerAndZoom(point,map.getZoom()); 
		
	});
	 
	 map.addOverlay(marker);  
}

  function loadDataperson() {
     
            var scrollPic_02 = new ScrollPic();
            scrollPic_02.scrollContId = "ISL_Cont_person"; //内容容器ID
            scrollPic_02.arrLeftId = "LeftArrperson"; //左箭头ID
            scrollPic_02.arrRightId = "RightArr"; //右箭头ID

            if (RegionUserInfoData.users.length < 4) {
                scrollPic_02.frameWidth = 80 * RegionUserInfoData.users.length; //显示框宽度
                scrollPic_02.pageWidth = 40 * RegionUserInfoData.users.length; //翻页宽度
            }
            else if (city_personData_user!=null&&city_personData_user!=0&&city_personData_user.split(',').length<4) {
                scrollPic_02.frameWidth = 80 * city_personData_user.split(',').length; //显示框宽度
                scrollPic_02.pageWidth = 40 * city_personData_user.split(',').length; //翻页宽度
            }
            else {
                scrollPic_02.frameWidth = 340; //显示框宽度
                scrollPic_02.pageWidth = 140; //翻页宽度
            }

            scrollPic_02.speed = 20; //移动速度(单位毫秒，越小越快)
            scrollPic_02.space = 2; //每次移动像素(单位px，越大越快)
            scrollPic_02.autoPlay = false; //自动播放
            scrollPic_02.autoPlayTime = 3; //自动播放间隔时间(秒)
            scrollPic_02.pageIndex = 0;
            //可以先判断长度，决定是否执行initialize方法
			if (RegionUserInfoData.users.length < 4||(city_personData_user!=null&&city_personData_user!=0&&city_personData_user.split(',').length<4)) {
                scrollPic_02.initializeLimit();  //初始化
            }
            else {
                scrollPic_02.initialize(); //初始化	
            }
            flagperson = false;
            return;
       
    }

    function loadDatacity() {   
           
            var scrollPic_02 = new ScrollPic();
            scrollPic_02.scrollContId = "ISL_Cont_city"; //内容容器ID
            scrollPic_02.arrLeftId = "LeftArrcity"; //左箭头ID
            scrollPic_02.arrRightId = "RightArrcity"; //右箭头ID

            if (RegionUserInfoData.cities.length < 4) {
                scrollPic_02.frameWidth = 80 * RegionUserInfoData.cities.length; //显示框宽度
                scrollPic_02.pageWidth = 40 * RegionUserInfoData.cities.length; //翻页宽度
            }
            else {
                scrollPic_02.frameWidth = 340; //显示框宽度
                scrollPic_02.pageWidth = 140; //翻页宽度
            }

            scrollPic_02.speed = 20; //移动速度(单位毫秒，越小越快)
            scrollPic_02.space = 2; //每次移动像素(单位px，越大越快)
            scrollPic_02.autoPlay = false; //自动播放
            scrollPic_02.autoPlayTime = 3; //自动播放间隔时间(秒)
            scrollPic_02.pageIndex = 0;
            //可以先判断长度，决定是否执行initialize方法
            if (RegionUserInfoData.cities.length < 4) {
                scrollPic_02.initializeLimit();  //初始化
            }
            else {
                scrollPic_02.initialize();  //初始化
            }
            flagcity=false;	
            return;
       
    }

    function timeChange(sender) {
        dateStr = $(sender).val();

        if ($(sender).val() == "4" && $("#dateTime1").val() != "" && $("#dateTime2").val() != "") {
            startdt = $("#dateTime1").val();
            enddt = $("#dateTime2").val();
            page = 1;
            loadUserLocationInfo();    
        }
        else if ($(sender).val() != "4") {
            $("#dateTime1").val("");
            $("#dateTime2").val("");
            startdt = "";
            enddt = "";
            page = 1;
            loadUserLocationInfo();    
        }
      
    }

    function dateChange() {
        if (dateStr == "4" && $("#dateTime1").val() != "" && $("#dateTime2").val() != "") {
            startdt = $("#dateTime1").val();
            enddt = $("#dateTime2").val();
            page = 1;
            loadUserLocationInfo();
        }
    }

    function previousPage() {
        if (page == 1) {
            //alert("已是第一页！");
            return false;
        }
        map.clearOverlays();
        pintterArr = new Array();
        page = page - 1;
        if(page==1){
        	$("#ppLeft").css("color","gray");	
        }
    	$("#ppRight").css("color","blue");	
        loadUserLocationInfo();
    }

    function nextPage() {
	    if(page == page_totle){
	        //alert("已是最后页！");
			return false;
		}
        map.clearOverlays();
        pintterArr = new Array();
        page = page + 1;
        if(page == page_totle){
        	$("#ppRight").css("color","gray");	
        }
    	$("#ppLeft").css("color","blue");	
    
        loadUserLocationInfo();
    }

    function userManager2Excel() {
    if (persionStr == -1) {        
        return;
    }
    $("#export1img").css("visibility", "visible");
    $.ajax({
        type: "get",
        url: "exportUserManager2Excel.action",
        data: { "dateStr": dateStr, "startdt": startdt, "enddt": enddt, "cityStr": cityStr, "persionStr": persionStr, "statusStr": statusStr, "page": 1, "limit": limit },
        dataType: "jsonp",
        success: function (datas) {
            openwin1(datas.fileURL)          
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            //alert(errorThrown);
        }
    });
}

function openwin1(url) {
    $("#export1").attr("href", url);
    $("#export1img").attr("src", "images/upload.png");

}

function userManagerExport() {
    $("#export1img").css("visibility", "hidden");
    $("#export1img").attr("src", "images/load.gif");
}


function addArrow(polyline,length,angleValue){ //绘制箭头的函数
			var linePoint=polyline.getPath();//线的坐标串
			var arrowCount=linePoint.length;
			for(var i =arrowCount-1;i>=1;i--){ //在拐点处绘制箭头
            var distance= map.getDistance(linePoint[i-1],linePoint[i]);
            if(distance>50)
            {
			    var pixelStart=map.pointToPixel(linePoint[i]);
			    var pixelEnd=map.pointToPixel(linePoint[i-1]);
			    var angle=angleValue;//箭头和主线的夹角
			    var r=length; // r/Math.sin(angle)代表箭头长度
			    var delta=0; //主线斜率，垂直时无斜率
			    var param=0; //代码简洁考虑
			    var pixelTemX,pixelTemY;//临时点坐标
			    var pixelX,pixelY,pixelX1,pixelY1;//箭头两个点
			    if(pixelEnd.x-pixelStart.x==0){ //斜率不存在是时
				    pixelTemX=pixelEnd.x;
				    if(pixelEnd.y>pixelStart.y)
				    {
				    pixelTemY=pixelEnd.y-r;
				    }
				    else
				    {
				    pixelTemY=pixelEnd.y+r;
				    }	
				    //已知直角三角形两个点坐标及其中一个角，求另外一个点坐标算法
				    pixelX=pixelTemX-r*Math.tan(angle); 
				    pixelX1=pixelTemX+r*Math.tan(angle);
				    pixelY=pixelY1=pixelTemY;
			    }
			    else  //斜率存在时
			    {
				    delta=(pixelEnd.y-pixelStart.y)/(pixelEnd.x-pixelStart.x);
				    param=Math.sqrt(delta*delta+1);
			
				    if((pixelEnd.x-pixelStart.x)<0) //第二、三象限
				    {
			        pixelTemX=pixelEnd.x+ r/param;
			        pixelTemY=pixelEnd.y+delta*r/param;
				    }
				    else//第一、四象限
				    {
			        pixelTemX=pixelEnd.x- r/param;
			        pixelTemY=pixelEnd.y-delta*r/param;
				    }
			        //已知直角三角形两个点坐标及其中一个角，求另外一个点坐标算法
				    pixelX=pixelTemX+ Math.tan(angle)*r*delta/param;
			        pixelY=pixelTemY-Math.tan(angle)*r/param;
			
			        pixelX1=pixelTemX- Math.tan(angle)*r*delta/param;
			        pixelY1=pixelTemY+Math.tan(angle)*r/param;
			    }
			
			    var pointArrow=map.pixelToPoint(new BMap.Pixel(pixelX,pixelY));
			    var pointArrow1=map.pixelToPoint(new BMap.Pixel(pixelX1,pixelY1));
			    var Arrow = new BMap.Polyline([
			        pointArrow,
			        linePoint[i-1],
			        pointArrow1
			    ], {strokeColor:"blue", strokeWeight:3, strokeOpacity:0.5});
			    arrowList.push(Arrow);
			    map.addOverlay(Arrow);
                }
			}
	}
    